{extend name="layout/layout" /}

{block name="pagecss"}
<style>
    #upload-image img {
        width: 100px;
        height: 100px;
        cursor: pointer;
        border: 1px solid #ccc;
    }
</style>
{/block}

{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="portlet light">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-share font-dark"></i>
                    <span class="caption-subject font-dark bold uppercase"> 编辑文件</span>
                </div>
                <div class="actions">
                    <a class="btn btn-circle btn-icon-only btn-default fullscreen" href="javascript:;" data-original-title="" title=""> </a>
                </div>
            </div>
            <div class="portlet-body">
                <form id="ajax-form" class="form-horizontal" method="post" enctype="multipart/form-data">
                    <div class="form-body">
                        <input class="city" type="hidden" name="cityId" value="{$info.cityId}">
                        <input class="xian" type="hidden" name="xianId" value="{$info.xianId}">
                        <input class="town" type="hidden" name="townId" value="{$info.townId}">
                        <input class="village" type="hidden" name="villageId" value="{$info.villageId}">
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        文件分类
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <p class="form-control-static"> {$typeName} </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        文件名称
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" placeholder="文件名称，最多80字" maxlength="80" data-required="1" name="name" value="{$info.name}" required>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        上传文件
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <div id="upload-image">
                                            <span id="upload-btn" data-multi="false" data-extensions="jpg,jpeg,png,pdf,doc,docx,xls,xlsx,ppt,pptx" data-max_file_size="10M">
                                                <!--<input type="hidden" class="form-control" id="coverImg" data-required="1" name="coverImg" value="">-->
                                                <!--<img src="{$info.imgUrl|default='__STATIC__/admin/img/picbg2.png'}" alt="图片上传" style="width: 100px;height: 100px;" />-->
                                                <div class="uploader-div">
													<span class="icon">+</span>
													<small></small>
												</div>
                                            </span>
                                        </div>
                                        <div class="help-block">
                                            <input type="text" class="form-control" data-required="1" name="fileUrl" value="{$info.fileUrl}" disabled>
                                        </div>
                                        <span class="help-inline">支持jpg、jpeg、png、pdf、doc(docx)、xls(xlsx)、ppt(pptx)；格式，大小不超过50M</span>
                                        <input type="hidden" name="fileName" value="{$info.fileName}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        公开设置
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <div class="mt-radio-inline open-type">
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="openType" name="openType" value="0" {if condition="($info['openType'] == 0)"}checked{/if} >
                                                所有人公开
                                                <span></span>
                                            </label>
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="openType" name="openType" value="1" {if condition="($info['openType'] == 1)"}checked{/if} >
                                                部分人公开
                                                <span></span>
                                            </label>
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="openType" name="openType" value="2" {if condition="($info['openType'] == 2)"}checked{/if} >
                                                仅对上传人公开
                                                <span></span>
                                            </label>

                                            <input type="hidden" class="openmemberIds" name="openmemberIds" value="" >
                                            <div class="openMember-list" style="display:none;">
                                                <button type="button" class="btn btn-success addMember-btn" style="margin-top: 10px;">
                                                    <i class="fa fa-plus"></i> 添加人员
                                                </button>
                                                <div class="portlet light" style="padding: 0">
                                                    <div class="portlet-body">
                                                        <form action="" class="form-horizontal" name="ajaxForm">
                                                            <div class="">
                                                                <table id="openMember-datatable" class="table table-bordered table-hover dataTable">
                                                                    <thead>
                                                                    <th>头像</th>
                                                                    <th>姓名</th>
                                                                    <th>操作</th>
                                                                    </thead>
                                                                </table>
                                                            </div>
                                                        </form>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <input type="hidden" name="id" value="{$info.id}">
                        <input type="hidden" name="typeId" value="{$typeId}">

                        <hr />
                        <div class="row">
                            <div class="form-actions">
                                <div class="col-md-offset-2 col-md-10">
                                    <button type="button" id="form-submit" class="btn blue save-btn">
                                        保存 <i class="fa fa-floppy-o"></i>
                                    </button>
                                    <button type="button" class="btn default" onclick="history.go(-1);">
                                        返回 <i class="fa fa-mail-forward"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<!-- 人员 模态框 -->
<div class="modal fade" id="viewMember-modal" data-backdrop="static" data-keyboard="false" >
    <div class="modal-dialog" style="width:800px; height: 520px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">x</button>
                <h4 class="modal-title">人员</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-12">
                        <div class="portlet light" style="margin-bottom: 0;">
                            <div class="box-header">
                                <div class="row">
                                    <div class="col-md-10">
                                        <form id="searchForm" action="" class="form" method="post">
                                            <div class="form-inline">
                                                <input class="city" type="hidden" name="cityId" value="{$librarytypeInfo.cityId}">
                                                <input class="xian" type="hidden" name="xianId" value="{$librarytypeInfo.xianId}">
                                                <input class="town" type="hidden" name="townId" value="{$librarytypeInfo.townId}">
                                                <p class="form-control-static"> {$area} </p>

                                                <input type="text" class="form-control" name="name" value="" placeholder="姓名">
                                                &nbsp;&nbsp;&nbsp;
                                                <button id="doSearch" type="button" class="btn btn-success" title="搜索">
                                                    <i class="fa fa-search"></i> 搜索
                                                </button>
                                                <button type="reset" class="btn btn-danger" title="清空">
                                                    <i class="fa fa-trash"></i> 清空
                                                </button>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                            <div class="portlet-body">
                                <form id="openmember-form" action="" class="form-horizontal" name="ajaxForm">
                                    <div class="">
                                        <table id="member-datatable" class="table table-bordered table-hover dataTable">
                                            <thead>
                                            <th>头像</th>
                                            <th>姓名</th>
                                            <th>职务</th>
                                            <th>操作</th>
                                            </thead>
                                        </table>
                                    </div>

                                    <button type="button" class="btn btn-circle btn-primary sellectall-btn" data-value="1"> 全选 </button>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn blue saveOpenmember-btn"> 确定 </button>
                <button type="button" class="btn default" data-dismiss="modal"> 关闭 </button>
            </div>
        </div>
    </div>
</div>

<input type="hidden" class="token_url" value="{:url('admin/Image/token')}">
<input type="hidden" class="record_url" value="{:url('admin/Image/record')}">
<input type="hidden" class="delimage_url" value="{:url('admin/Image/delete')}">

<input type="hidden" class="save_url" value="{:url('admin/'.strtolower($model).'/savepost')}">

<input type="hidden" class="openMemberDatalist_url" value="{:url('admin/'.strtolower($model).'/openmemberlist')}">
<input type="hidden" class="memberDatalist_url" value="{:url('admin/'.strtolower($model).'/memberlist')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/admin/js/qiniu/plupload.full.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniu.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/custom.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniuConfig.js" type="text/javascript"></script>

<script src="__STATIC__/admin/pages/js/library.js" type="text/javascript"></script>
{/block}